#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b); 
}
int main()
{
	int a,b;
	while(cin>>a>>b)
	{
		if(a<b) swap(a,b);
	    int num=gcd(a,b);
	    cout<<a+b-gcd(a,b)<<'\n';
	}

	return 0;
}

